package itcast.web.servlet;

import itcast.domain.Buildmanager;
import itcast.service.BuildmanagerService;
import itcast.service.impl.BuildmanagerServiceimpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/findBuildmanagerServlet")
public class findBuildmanagerServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        //获取id
        String id=request.getParameter("id");
        //2.调用Service查询
        BuildmanagerService service=new BuildmanagerServiceimpl();
        Buildmanager buildmanager =service.findBuildmanagerById(id);
        //3.将buildmanager存入request
        request.setAttribute("buildmanager",buildmanager);
        //4.转发到updatebuildmanager
        request.getRequestDispatcher("/systemadmin/updatebuildmanage.jsp").forward(request,response);

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        this.doPost(request,response);
    }
}
